import axios from 'axios';

const fundApi = {
  // 获取基金图表数据
  getChartData: async (interval, fundType, board = 'consumption') => {
    try {
      const response = await axios.get('/api/v1/fund/chart-data', {
        params: {
          interval,
          fund_type: fundType,
          board
        }
      });
      return response.data;
    } catch (error) {
      console.error('Failed to fetch chart data:', error);
      throw error;
    }
  },

  // 获取基金类型列表
  getFundTypes: async (board = 'consumption') => {
    try {
      const response = await axios.get('/api/v1/fund/types', {
        params: { board }
      });
      return response.data;
    } catch (error) {
      console.error('Failed to fetch fund types:', error);
      throw error;
    }
  }
};

export default fundApi; 